package org.sgx.gwteditors.client.editor.props;

import java.util.HashMap;
import java.util.Map;

import org.sgx.gwteditors.client.util.LWOMap;
/**
 * this can be used to simulate a PH from other type of data, for example json objects .
 * @author sg
 *
 */
public class AbstractPropertyHaver implements PropertyHaver {
	LWOMap<String, PropertyInfo> props = null; 
	Map<String, Object> values; 
	
	public AbstractPropertyHaver() {
		props = new LWOMap<String, PropertyInfo>(); 
		values=new HashMap<String, Object>(); 
	}
	
	@Override
	public String toString() {
		return PropertyHaverUtil.print(this); 
	}
	@Override
	public LWOMap<String, PropertyInfo> getProperties() {
		return props;
	}

	@Override
	public Object propertyGet(String propertyName) {
		return values.get(propertyName); 
	}

	@Override
	public void propertySet(String propertyName, Object val) {
		values.put(propertyName, val); 
	}

}
